package b3.widget.guide
{
	import b3.net.*;
	import b3.scene.build.*;
	import b3.scene.build.phyObj.*;
	import b3.scene.home.*;
	import b3.util.*;
	import b3.widget.*;
	import b3.widget.basic.*;
	import b3.widget.home.bottom.*;
	import b3.widget.tab.Tab;
	
	import flash.display.*;
	import flash.events.*;

	public class RedBuildingGuide extends BuildingGuide
	{
		public function RedBuildingGuide()
		{
			super();
		}
		
		override public function step1():void
		{
			//点建筑
			var clickableHole:ClickableHole = new ClickableHole(-235, -85, 80, 80);
			clickableHole.anchor = BasicWidget.ANCHOR_MIDDLE_BOTTOM;
			addChild(clickableHole);
			//箭头
			var NewHelperArrow:Class = ResourceHelper.getInstance().getClassByName("NewHelperArrow");
			var arrow:BasicWidget = new BasicWidget();
			arrow.addChild(new NewHelperArrow());
			arrow.anchor = BasicWidget.ANCHOR_MIDDLE_BOTTOM;
			arrow.x = -200;
			arrow.y = -150;
			addChild(arrow);
			var buildingTitle:Sprite = BottomPane.getInstance().tabTitles[1];
			buildingTitle.addEventListener(MouseEvent.CLICK, onStep2);
		}
		
		private function onStep2(event:Event):void
		{
			//去除钩子
			var buildingTitle:Sprite = BottomPane.getInstance().tabTitles[1];
			buildingTitle.removeEventListener(MouseEvent.CLICK, onStep2);
			//清除所有
			clearAll();
			//点红楼			
			var clickableHole:ClickableHole = new ClickableHole(-167, -125, 88, 108);
			clickableHole.anchor = BasicWidget.ANCHOR_MIDDLE_BOTTOM;
			addChild(clickableHole);
			//箭头
			var NewHelperArrow:Class = ResourceHelper.getInstance().getClassByName("NewHelperArrow");
			var arrow:BasicWidget = new BasicWidget();
			arrow.addChild(new NewHelperArrow());
			arrow.anchor = BasicWidget.ANCHOR_MIDDLE_BOTTOM;
			arrow.x = -122;
			arrow.y = -200;
			addChild(arrow);
			//加钩下一步
			BuildScene.getInstance().eventDispatcher.addEventListener(BuildScene.GAME_START, onStep3);
		}  
		
		private function onStep3(event:Event):void
		{
			//去除钩子
			BuildScene.getInstance().eventDispatcher.removeEventListener(BuildScene.GAME_START, onStep3);
			//清除所有
			clearAll();
			//点击屏幕
			BuildScene.getInstance().eventDispatcher.addEventListener(BuildScene.GAME_END, onStep6);
		}
		
		private function onStep6(event:Event):void
		{
			//清除所有
			clearAll();
			//去除钩子
			BuildScene.getInstance().eventDispatcher.removeEventListener(BuildScene.GAME_END, onStep6);
			//加钩下一步
			HomeScene.getInstance().eventDispatcher.addEventListener(HomeScene.MODE_SWITCH, onStep7);
		}
		
		private function onStep7(event:Event):void
		{
			//清除所有
			clearAll();
			//去除钩子
			HomeScene.getInstance().eventDispatcher.removeEventListener(HomeScene.MODE_SWITCH, onStep7);
			showTipDialog("注意红楼只能放在蓝楼的边上哦！");
			//加钩下一步
			HomeScene.getInstance().eventDispatcher.addEventListener(HomeScene.MODE_SWITCH, onStep8);
		}
		
		private function onStep8(event:Event):void
		{
			//清除所有
			clearAll();
			//去除钩子
			HomeScene.getInstance().eventDispatcher.removeEventListener(HomeScene.MODE_SWITCH, onStep8);
			var dialog:NpcDialog = new NpcDialog("NpcSecretary1", ["这么快就建好了红楼，不愧是建筑界的天才!", "接下去要建更多的楼，注意自己的体力和财富分配哦~"]);
			WidgetManager.getInstance().popOutOneByOne(dialog);
			//结束
			close();
		}
	}
}